<?php
class CateModel extends Model{
    //定义表名
    public $table = 'catetype';

    //表单验证
    public $validate = array(
        //用户名验证
        array('catename','nonull','类型名不能为空',1,3),
    );

    //查询一条类型详情
    public function cateone($where){
        return $this -> where($where) -> find();
    }

    //添加类型
    public function addcate($data){
        return $this -> add($data);
    }

    //修改类型资料
    public function upcate($where,$data){
        return $this -> where($where) -> save($data);
    }
    //查询类型列表
    public function catelist($where = '',$limit = ''){
        return $this -> where($where) -> all();
    }

    //删除类型
    public function catedel($where){
        return $this -> where($where) -> del();
    }
}